<?php
/**
 * Created by PhpStorm.
 * user: songlintao
 * Date: 2017/9/1
 * Time: 下午5:20
 */

namespace app\model;

use core\lib\baseModel;

class user extends baseModel {
	public $username;
	public $password;
	public $id;

	public function login( $username, $password ) {
		if ( empty( $username ) || empty( $password ) ) {
			API_ERROR( 10001, "请输入用户名密码！" );
		} else {
			$datas = $this->count( $this->getTableName(), [
				'username' => $username,
				'password' => $password
			] );
			if ( $datas >= 1 ) {
				API_SUCCESS();
			} else {
				API_ERROR( 1000, "用户名或密码不正确！" );
			}
		};
	}

}